package com.lykj.modules.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lykj.modules.system.entity.Dept;
import com.lykj.modules.system.entity.UserAddress;
import com.lykj.modules.system.vo.DeptVO;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * 收货地址 Mapper 接口
 *
 * @author cxl
 */
public interface UserAddressMapper extends BaseMapper<UserAddress> {

    @Update(value = {
            "UPDATE lykj_user_address SET is_default=FALSE WHERE uid = #{userId};",
            "UPDATE lykj_user_address SET is_default=TRUE WHERE id = #{addressId};",
    })
    void shippingAddressAsDefault(Long userId, String addressId);

    @Update(value = {
            "UPDATE lykj_user_address SET is_default=FALSE WHERE uid = #{userId};"
    })
    int updateIsDefaultFalse(Long userId);
}
